<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // var str = prompt('');
        // console.log(str.replace('mmp','***'));

        var str1 = 'aaabbadbccbacbd'
        var obj = {}
        var num = 0
        for(var i=0;i<str1.length;i++){ 
            if(obj[str1[i]]){
                obj[str1[i]]++
            }else{
                obj[str1[i]]=1
            }
        }
        console.log(obj)
    </script>

</body>
</html>